package com.ygqh.baby.model;

import com.ygqh.baby.ao.PayType;
import com.ygqh.baby.po.YgPrepayBookRecord;

import java.util.Date;

/**
 *
 * @Auther: sunshuo
 * @Date: 2018/7/31 13:28
 * @Description:
 */
public class ProductBookRecordModel extends YgPrepayBookRecord {

	private Date bookStartTime;

	private Date bookEndTime;

	private Date tailMoneyStartTime;

	private Date tailMoneyEndTime;

	private String orderPayCode;

	private PayType payType;

	public Date getBookStartTime() {
		return bookStartTime;
	}

	public void setBookStartTime(Date bookStartTime) {
		this.bookStartTime = bookStartTime;
	}

	public Date getBookEndTime() {
		return bookEndTime;
	}

	public void setBookEndTime(Date bookEndTime) {
		this.bookEndTime = bookEndTime;
	}

	public Date getTailMoneyStartTime() {
		return tailMoneyStartTime;
	}

	public void setTailMoneyStartTime(Date tailMoneyStartTime) {
		this.tailMoneyStartTime = tailMoneyStartTime;
	}

	public Date getTailMoneyEndTime() {
		return tailMoneyEndTime;
	}

	public void setTailMoneyEndTime(Date tailMoneyEndTime) {
		this.tailMoneyEndTime = tailMoneyEndTime;
	}

	public String getOrderPayCode() {
		return orderPayCode;
	}

	public void setOrderPayCode(String orderPayCode) {
		this.orderPayCode = orderPayCode;
	}

	public PayType getPayType() {
		return payType;
	}

	public void setPayType(PayType payType) {
		this.payType = payType;
	}

	public String getPayTypeDesc() {
		return payType == null ? null : payType.getTitle();
	}

	public boolean inValidTailMoneyTime(Date now) {
		if (this.tailMoneyStartTime != null && this.tailMoneyStartTime.compareTo(now) <= 0
				&& this.tailMoneyEndTime!= null && this.tailMoneyEndTime.compareTo(now) >= 0) {
			return true;
		}
		return false;
	}

	@Override
	public String toString() {
		return "ProductBookRecordModel{" +
				"bookStartTime=" + bookStartTime +
				", bookEndTime=" + bookEndTime +
				", tailMoneyStartTime=" + tailMoneyStartTime +
				", tailMoneyEndTime=" + tailMoneyEndTime +
				", orderPayCode='" + orderPayCode + '\'' +
				", payType='" + payType + '\'' +
				'}';
	}
}
